﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title></title>
		<link rel="Stylesheet" href="Resources/Style.css" />
	</head>
	<body>
	    <div class="header">TFS WORKITEM WATCHER</div> 

        <div class="main">
            <h2>Index</h2>
            
            <ul class="index">
                <li>
                    <a href="#About"><b>About</b></a>
                </li>
                <li>
                    <a href="#Requirements"><b>Requirements</b></a>
                </li>
                <li>
                    <a href="#DefaultInstall"><b>Installation with default settings</b></a>
                </li>
                <li>
                    <a href="#TroubleShooting"><b>Trouble shooting</b></a>
                </li>
                <li>
                    <a href="#Architecture"><b>Architectural concepts</b></a>
                </li>
                <li>
                    <a href="#ObserverAccountProviders"><b>Provided ObserverAccountProviders</b></a>
                </li>
                <li>
                    <a href="#NotifyProviders"><b>Provided NotifyProviders</b></a>
                </li>
                <li>
                    <a href="#OwnObserverAccountProvider"><b>Implementing an own ObserverAccountProvider</b></a>
                </li>
                <li>
                    <a href="#OwnNotifyProvider"><b>Implementing an own NotifyProvider</b></a>
                </li>
            </ul>
            
            <p class="separation" />
            
            <h2><a name="About">About</a></h2>
            
            <p>
                TFSWIWatcher is a server side plugin which allows you to register for watching workitems in Team Foundation Server 2015. The plugin can be configured to use different logic to retrieve accounts to be notified and to deliver messages to the accounts to be notified.
            </p>
            
            <p>
                By default TFSWIWatcher watches all changes of workitems and determines the 
                accounts to be notified by looking up the texbox in a new tab of the workitem 
                called Observers. This tab holds a list of account names - each account name on a 
                singe line:
            </p>

            <img src="Resources/ObserverTab.jpg" alt="Observer Tab" />
            
            <p>
                <span lang="EN-US">TFSWIWatcher will then determine the email addresses of the 
                provided account names and will send a mail to each account.</span>
            </p>
            
            <p class="separation" />
            
            <h2><a name="Requirements">Requirements</a></h2>
            
            <ul class="index">
                <li>
                    <a href="https://www.visualstudio.com/de-de/products/tfs-overview-vs.aspx"><b>Team Foundation Server 2015</b></a>
                </li>
                <li>
                    <a href="https://visualstudiogallery.msdn.microsoft.com/898a828a-af00-42c6-bbb2-530dc7b8f2e1"><b>Team Foundation Server Power Tools 2015</b></a>&nbsp;
                </li>
            </ul>
            
            <p class="separation" />
            
            <h2><a name="DefaultInstall">Installation with default settings</a></h2>
            
            <div class="lightIndent">
                <h3>Team Foundation Power Tools Installation</h3>
                <p>
                    If you've not already installed TFPT please download and install it using the link under <b>>> <a href="#Requirements">Requirements</a> <<</b>. You will need TFPT to complete the next step.
                </p>
                
                <h3>Adding the Observer-Tab for Workitems</h3>
                <p>
                    After installing TFPT there will be a new Menu under Tools called "Process Editor":
                </p>
                
                <img src="Resources/OpenWITMenu.jpg" alt="Open Workitem Menu" />
                
                <p>
                    Please navigate to the selection in the above screenshot.
                </p>
                <p>
                    In the next dialog choose one of the provided workitem types (you will need to reapeat the following steps for all other types):
                </p>
                
                <img src="Resources/SelectWorkItemType.jpg" alt="Select Work Item Type" />
                
                <p>
                    In the next dialog click "New" and fill the poup with the Information from the screenshot and press "ok":
                </p>
                
                <img src="Resources/FieldDefinition.jpg" alt="Field Definition" />
                
                <p>
                    In the next dialog click "New" and fill the poup with the Information from the screenshot and press "ok":
                </p>
                
                <img src="Resources/WorkitemLayout.jpg" alt="Work Item Layout" />
                
                <p>
                    Call it "Observers":
                </p>
                
                <img src="Resources/ObserverTabLabel.jpg" alt="Tab Page Name" />
                
                <p>
                    Add a "New Control" to the newly created Tab Page:
                </p>
                
                <img src="Resources/NewControlOnTab.jpg" alt="New control on tab" />
                
                <p>
                    Configure the Control exactly as in the following screenshot:
                </p>
                
                <a name="FieldName">
                    <img src="Resources/NewControlOnTabOptions.jpg" alt="New control on tab options" />
                </a>
                
                <p>
                    Save the result and after opening a workitem you'll have a new Tab "Observers":
                </p>
                
                &nbsp;<h3>Installing the Plugin</h3>
                <p>
                    To get the plugin running you have to copy the following files into the Plugins folder of Team Foundation Server 2015 (AppTier). For a standard installation the path to copy the following files would be something like this: &quot;<a href="file:///C:/Program%20Files/Microsoft%20Team%20Foundation%20Server%2011.0/Application%20Tier/Web%20Services/bin/Plugins">C:\Program Files\Microsoft Team Foundation Server 11.0\Application Tier\Web Services\bin\Plugins</a>&quot;</p>
                
                <div>
                    The following files have to be copied to the Plugins folder:
                    <ul style="margin-left: 30px">
                        <li>log4net.dll (The logging framework)</li>
                        <li>TFSWIWatcher.BL.dll (The plugin)</li>
                        <li>TFSWIWatcher.BL.dll.config (You can modify settings for the plugin here)</li>
                        <li>TFSWIWatcher.BL.dll.logconfig (You can modify settings for logging here)</li>
                    </ul>
                </div>
                
                <p>
                    Make sure that you have configured your mail settings in the Administrative Console of Team Foundation Server! Because the plugin will use the Mail-Settings of TFS to send mails.<br/>
                    <strong>Dont forgett to restart the TFS App Tier after the Plugin has been deployed!</strong>
                </p>

            </div>
            
            <p class="separation" />
        
            <h2><a name="TroubleShooting">Trouble shooting</a></h2>
            
            <p>
                When errors arise they are logged to a file named
                <strong>TFSWIWatcherlog.txt</strong> in the <strong>Temp-Directory</strong> of your server. Lo4Net is used for logging. You can change the way logging is done through modifying the content of the file <strong>TFSWIWatcher.BL.dll.logconfig</strong>:</p>
            <p>
                More
                information about how to change this config and which possibilities exist can be found 
                at the <b>&gt;&gt; <a href="http://logging.apache.org/log4net/">Log4Net website</a> &lt;&lt;</b>.</p>
            
            <p class="separation" />
            <h2><a name="Architecture">Architectural concepts</a></h2>
            
            <div class="lightIndent">
                <h3>Overview</h3>
                <br />
                <a href="Resources/ArchitectureOverview.jpg">
                    <img src="Resources/ArchitectureOverviewSmall.jpg" border="1" alt="Architecture Overview" />
                </a>
                <br />
                    
                <h3>1. Determining accounts to notify</h3>
                <p>
                    
                    In the configuration file TFSWIWatcher.Service.exe.config there is a section 
                    called <strong>ObserverAccountProviders</strong>. This section lists all providers 
                    collecting accounts to notify. By default there is a single provider in this 
                    list called <strong>TFSObserverAccountProvider</strong>. This provider gets the accounts 
                    from the observer field in the workitem that was changed by parsing the field 
                    line (account name) by line (account name). More information about 
                    ObserverAccountProviders are under <b>&gt;&gt; <a href="#ObserverAccountProviders">this section</a> 
                    &lt;&lt;</b>.</p>
                    
                <h3>2. Notifying accounts</h3>
                <p>
                    
                    In the configuration file TFSWIWatcher.Service.exe.config there is a section 
                    called <strong>NotifyProviders</strong> . This section lists all providers 
                    notifying accounts. By default there is a single provider in this 
                    list called <strong>MailNotifyProvider</strong>. This provider notifies the 
                    accounts by getting there mail addresses from user profile and sending them a 
                    mail containing a change report. More information about 
                    NotifyProviders are under <b>&gt;&gt; <a href="#CredentialsProviders">this section</a> 
                    &lt;&lt;</b>.</p>
            </div>
            
            <p class="separation" />
            
            <h2><a name="ObserverAccountProviders">Provided ObserverAccountProviders</a></h2>
            
            <div class="lightIndent">
                <h3>Choosing an ObserverAccountProvider</h3>
                <p>
                    You can add/remove/enable/disable an ObserverAccountProvider by changing the <strong>ObserverAccountProviders section</strong>. By default this section looks like the section below:
                </p>
                
                <img src="Resources/ObserverAccountProvidersSection.jpg" alt="Observer Account Providers Section" />
                
                <p>
                    The above configuration is for the <strong>TFSObserverAccountProvider</strong>, which is the default 
                    ObserverAccountProvider. Compared to CredentialsProviders there can be multiple 
                    ObserverAccountProviders. You can disabled a provider by setting the <strong>enabled</strong> attribute to false or by removing the provider from the ObserverAccountProviders section.</p>
                    
                <h3>1. TFSObserverAccountProvider</h3>
                <p>
                    This provider is the default ObserverAccountProvider
                    to use it just add the line from the above heading. This provider needs further 
                    information which is configured using a custom configuration section. This 
                    section must be registered using the following line:</p>
                    
                <img src="Resources/TFSObserverAccountProviderConfigSectionregistration.jpg" alt="TFSObserverAccountProvider ConfigSection Registration" />
                
                <p>
                    The last step is to add the following section and to customize the settings:
                </p>
                
                <img src="Resources/TFSObserverAccountProviderConfigSection.jpg" alt="TFSObserverAccountProvider ConfigSection" />
                
                <p>
                    The setting <strong>ObserverFieldName</strong> is the field of the workitem where the TFSObserverAccountProvider searches for accounts to notify.
                    The default field name is <strong>DNE.Observers</strong>. You can change the name of the field but dont forgett to consider it in <b>
                    &gt;&gt; <a href="#FieldName">this step</a> &lt;&lt;</b>.The <strong>RegexPattern</strong> and 
                    <strong>RegexOptions</strong> field is used to extract the account names from the field holding 
                    the account names. The regular expression used here extracts the account names 
                    line by line. If you want to change the regular expression please consider 
                    having a group called <strong>user</strong> in your regular expression - this is mandatory. 
                    The provider also checks the observers of the previous workitem revision and 
                    will send a single notify mail to accounts that where removed from the list of 
                    observers, so that those observers can detect an unwanted removal from the 
                    list of observer.</p>
            </div>
            
            <p class="separation" />
            
            <h2><a name="NotifyProviders">Provided NotifyProviders</a></h2>
            
            <div class="lightIndent">
                <h3>Choosing a NotifyProvider</h3>
                <p>
                    You can add/remove/enable/disable a NotifyProvider by changing the <strong>NotifyProviders section</strong>. By default this section looks like the section below:
                </p>
                
                <img src="Resources/NotifyProviders.jpg" alt="Notify Providers" />
                
                <p>
                    The above configuration is for the <strong>MailNotifyProvider</strong>, which is the default 
                    NotifyProvider. Compared to CredentialsProviders there can be multiple 
                    NotifyProviders. You can disabled a provider by setting the <strong>enabled</strong> attribute to false or by removing the provider from the NotifyProviders section.</p>
                
                <h3>1. MailNotifyProvider</h3>
                <p>
                    This provider is notifying accounts through sending mails. The mail address of the account names is determined through team foundation server API. 
                    This provider is the default NotifyProvider, to use it just add the line from 
                    the above heading. This provider needs further information which is configured 
                    using a custom configuration section. This section must be registered using the 
                    following line:</p>
                
                <img src="Resources/MailNotifyConfigRegistration.jpg" alt="Mail Notify Config Registration" />
                
                <p>
                    The next step is to add the following section and to customize the settings:
                </p>
                
                <img src="Resources/MailNotifyConfig.jpg" alt="Mail Notify Config" />
               
                
                &nbsp;</div>
            
            <p class="separation" />
            
           <h2><a name="OwnObserverAccountProvider">Implementing an own ObserverAccountProvider</a></h2>
            
            <div class="lightIndent">
                <p>
                    To implement your own ObserverAccountProvider just create a project and reference the assembly <strong>TFSWIWatcher.BL</strong> and create a class implementing the interface <strong>IObserverAccountProvider</strong> which is located in namespace <strong>TFSWIWatcher.BL.Providers</strong>. The interface has the following definition: 
                </p>
                
                <img src="Resources/IObserverAccountProvider.jpg" alt="IObserverAccountProvider" />
                
                <p>
                    The method <strong>Initialize()</strong> is called once by the service to allow the implementing provider to read configuration settings and to do other initialization stuff. The method <strong>GetObservers(..)</strong> is called each time a workitem change has occured. The implementing provider should return a list of accounts to be notified for this workitem change. The <strong>context parameter</strong> provides the implementing provider with information about the workitem and so on.
                </p>
            </div>
            
            <p class="separation" />
            
            <h2><a name="OwnNotifyProvider">Implementing an own NotifyProvider</a></h2>
            
            <div class="lightIndent">
                <p>
                    To implement your own NotifyProvider just create a project and reference the assembly <strong>TFSWIWatcher.BL</strong> and create a class implementing the interface <strong>INotifyProvider</strong> which is located in namespace <strong>TFSWIWatcher.BL.Providers</strong>. The interface has the following definition: 
                </p>
                
                <img src="Resources/INotifyProvider.jpg" alt="INotifyProvider" />
                
                <p>
                    The method <strong>Initialize()</strong> is called once by the service to allow the implementing provider to read configuration settings and to do other initialization stuff. The method <strong>Notify(..)</strong> is called each time a workitem change has occured. The implementing provider gets passed a list of accounts to notify for this workitem change as well as a context parameter providing information about the workitem and so on.
                </p>
            </div>
        </div>
	</body>
</html>